<template>
  <div class="container">
    <el-row type="flex" justify="space-between">
      <!-- 订单表单 -->
      <OrderForm
        v-if="insurance.insurances"
        :data="insurance"
        @totalPrice="totalPrice"
      />

      <!-- 侧边栏 -->
      <OrderAside
        v-if="insurance.insurances"
        :data="insurance"
        :price="claTotalPrice"
      />
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      insurance: {},
      claTotalPrice: 0,
    };
  },
  mounted() {
    // 返送获取保险的数据
    this.$axios({
      url: "/airs/" + this.$route.query.id,
      params: {
        seat_xid: this.$route.query.seat_xid,
      },
    }).then((res) => {
      // console.log(res);
      this.insurance = res.data;
      console.log(this.insurance.insurances);
    });
  },
  methods: {
    totalPrice(price) {
      this.claTotalPrice = price;
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  width: 1000px;
  margin: 20px auto;
}

/*aside*/
.aside {
  width: 350px;
  height: fit-content;
  border: 1px #ddd solid;
}
</style>